home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / konq_drag.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.7 KB  |  123 lines

  1. /*  This file is part of the KDE project
  2.     Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
  3.  
  4.     This program is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU General Public License as published by
  6.     the Free Software Foundation; either version 2 of the License, or
  7.     (at your option) any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program; if not, write to the Free Software
  16.     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  17. */
  18.  
  19. #ifndef __konqdrag_h__
  20. #define __konqdrag_h__
  21.  
  22. #include <qdragobject.h>
  23. #include <qrect.h>
  24. #include <qstring.h>
  25. #include <qiconview.h>
  26.  
  27. #include <libkonq_export.h>
  28.  
  29. #include <kurl.h>
  30.  
  31. /*****************************************************************************
  32.  *
  33.  * Class KonqIconDrag
  34.  *
  35.  *****************************************************************************/
  36.  
  37. // Clipboard/dnd data for: Icons + URLS + isCut
  38. class LIBKONQ_EXPORT KonqIconDrag : public QIconDrag
  39. {
  40.     Q_OBJECT
  41.  
  42. public:
  43.     KonqIconDrag( QWidget * dragSource, const char* name = 0 );
  44.     virtual ~KonqIconDrag() {}
  45.  
  46.     const char* format( int i ) const;
  47.     QByteArray encodedData( const char* mime ) const;
  48.  
  49.     void append( const QIconDragItem &item, const QRect &pr,
  50.                  const QRect &tr, const QString &url );
  51.  
  52.     void setMoveSelection( bool move ) { m_bCutSelection = move; }
  53.  
  54.     static bool canDecode( const QMimeSource* e );
  55.  
  56. protected: // KDE4: private. And d pointer...
  57.     QStringList urls;
  58.     bool m_bCutSelection;
  59. };
  60.  
  61. /**
  62.  * Clipboard/dnd data for: Icons + URLs + MostLocal URLs + isCut
  63.  * KDE4: merge with KonqIconDrag
  64.  * @since 3.5
  65.  */
  66. class LIBKONQ_EXPORT KonqIconDrag2 : public KonqIconDrag
  67. {
  68.     Q_OBJECT
  69.  
  70. public:
  71.     KonqIconDrag2( QWidget * dragSource );
  72.     virtual ~KonqIconDrag2() {}
  73.  
  74.     virtual const char* format( int i ) const;
  75.     virtual QByteArray encodedData( const char* mime ) const;
  76.  
  77.     void append( const QIconDragItem &item, const QRect &pr,
  78.                  const QRect &tr, const QString &url, const KURL &mostLocalURL );
  79.  
  80. private:
  81.     QStringList m_kdeURLs;
  82. };
  83.  
  84. // Clipboard/dnd data for: URLS + isCut
  85. class LIBKONQ_EXPORT KonqDrag : public QUriDrag
  86. {
  87. public:
  88.     // KDE4: remove, use KonqDrag constructor instead
  89.     static KonqDrag * newDrag( const KURL::List & urls,
  90.                                bool move, QWidget * dragSource = 0, const char* name = 0 );
  91.  
  92.     /**
  93.      * Create a KonqDrag object.
  94.      * @param urls a list of URLs, which can use KDE-specific protocols, like system:/
  95.      * @param mostLocalUrls a list of URLs, which should be resolved to most-local urls, i.e. file:/
  96.      * @param cut false for copying, true for "cutting"
  97.      * @param dragSource parent object
  98.      * @since 3.5
  99.      */
  100.     KonqDrag( const KURL::List & urls, const KURL::List& mostLocalUrls, bool cut, QWidget * dragSource = 0 );
  101.  
  102. protected:
  103.     // KDE4: remove
  104.     KonqDrag( const QStrList & urls, bool cut, QWidget * dragSource, const char* name );
  105.  
  106. public:
  107.     virtual ~KonqDrag() {}
  108.  
  109.     virtual const char* format( int i ) const;
  110.     virtual QByteArray encodedData( const char* mime ) const;
  111.  
  112.     void setMoveSelection( bool move ) { m_bCutSelection = move; }
  113.  
  114.     // Returns true if the data was cut (used for KonqIconDrag too)
  115.     static bool decodeIsCutSelection( const QMimeSource *e );
  116.  
  117. protected: // KDE4: private. And d pointer...
  118.     bool m_bCutSelection;
  119.     QStrList m_urls; // this is set to the "most local urls". KDE4: KURL::List
  120. };
  121.  
  122. #endif
  123.